home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume3 / pathalias2 / part1 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  24.4 KB

  1. Subject: New pathalias, part 1 of 2
  2. Newsgroups: mod.sources
  3. Approved: jpn@panda.UUCP
  4.  
  5. Mod.sources:  Volume 3, Issue 92
  6. Submitted by: princeton!down!honey (Peter Honeyman)
  7.  
  8. #! /bin/sh
  9. # This is a shell archive, meaning:
  10. # 1. Remove everything above the #! /bin/sh line.
  11. # 2. Save the resulting text in a file.
  12. # 3. Execute the file with /bin/sh (not csh) to create the files:
  13. #    README
  14. #    CHANGES
  15. #    Makefile
  16. #    config.h
  17. #    def.h
  18. #    make.v8
  19. #    pathalias.1
  20. # This archive created: Wed Jan 22 19:21:55 1986
  21. export PATH; PATH=/bin:$PATH
  22. echo shar: extracting "'README'" '(899 characters)'
  23. if test -f 'README'
  24. then
  25.     echo shar: will not over-write existing file "'README'"
  26. else
  27. sed 's/^X//' << \SHAR_EOF > 'README'
  28. XFrom princeton!honey Sun Jan 19 18:35:58 EST 1986
  29. To: whom it may concern
  30. Subject: pathalias instructions
  31.  
  32. edit config.h
  33. make
  34.  
  35. if getopt is undefined, obtain a copy from mod.sources.  pathalias input
  36. is regularly published in mod.map.
  37.  
  38.     peter
  39.  
  40. ps:
  41.  
  42. pathalias, written by steve bellovin and peter honeyman, is in the public
  43. domain, and may be used by any person or organization, in any way and for
  44. any purpose.
  45.  
  46. pps:
  47.  
  48. There is no warranty of merchantability nor any warranty of fitness for
  49. a particular purpose nor any other warranty, either express or implied,
  50. as to the accuracy of the enclosed materials or as to their suitability
  51. for any particular purpose.  Accordingly, the authors assume no respon-
  52. sibility for their use by the recipient.   Further, the authors assume
  53. no obligation to furnish any assistance of any kind whatsoever, or to
  54. furnish any additional information or documentation.
  55. SHAR_EOF
  56. if test 899 -ne "`wc -c < 'README'`"
  57. then
  58.     echo shar: error transmitting "'README'" '(should have been 899 characters)'
  59. fi
  60. fi
  61. echo shar: extracting "'CHANGES'" '(691 characters)'
  62. if test -f 'CHANGES'
  63. then
  64.     echo shar: will not over-write existing file "'CHANGES'"
  65. else
  66. cat << \SHAR_EOF > 'CHANGES'
  67. -- mod.sources, 4.3bsd, 1/86
  68. Improved alias treatment.
  69. Routes to domain gateways.
  70. New domain treatment -- leading dot in name implies domain.
  71. Print fully qualified domain name for private hosts.
  72. Link/host tracing (-t option).
  73. Use getopt().
  74.  
  75. -- mod.sources, 8/85
  76. Private hosts documented.
  77. Homegrown scanner -- it's true what they say about lex.
  78. Makedb.
  79. Domains and gateways.
  80. DEAD back link.
  81.  
  82. -- net.sources, 1/85
  83. No ! in dbm key.
  84. Network character must be one of !@%: -- dot is dead.
  85. Private hosts.
  86. Discourage hybrid addresses.  
  87. Magic @ <-> % rule.
  88.  
  89. -- 1983-1984
  90. Reverse sense of the -c (cost) flag.
  91. Use cheapest among duplicate links.
  92. Elide network names in output.
  93.  
  94. -- epoch (smb version)
  95. SHAR_EOF
  96. if test 691 -ne "`wc -c < 'CHANGES'`"
  97. then
  98.     echo shar: error transmitting "'CHANGES'" '(should have been 691 characters)'
  99. fi
  100. fi
  101. echo shar: extracting "'Makefile'" '(1078 characters)'
  102. if test -f 'Makefile'
  103. then
  104.     echo shar: will not over-write existing file "'Makefile'"
  105. else
  106. cat << \SHAR_EOF > 'Makefile'
  107. #!/bin/make -f
  108. # pathalias -- by steve bellovin, as told to peter honeyman
  109.  
  110. # if you can't or don't intend to use dbm files, don't bother with makedb
  111. DBM = -ldbm
  112. # or if you roll your own ...
  113. # DBM = dbm.o
  114.  
  115. CC = cc
  116. CFLAGS = -O
  117. LDFLAGS = -s
  118. YFLAGS = -d
  119.  
  120. OBJ = addlink.o addnode.o extern.o local.o main.o mapit.o mapaux.o mem.o parse.o printit.o
  121. HDRS = def.h config.h
  122. CSRC = addlink.c addnode.c extern.c local.c main.c mapit.c mapaux.c mem.c printit.c
  123. SRC = $(CSRC) parse.y
  124. LSRC = $(CSRC) parse.c
  125.  
  126. pathalias: $(OBJ)
  127.     $(CC) $(LDFLAGS) $(OBJ) -o pathalias
  128.  
  129. all: pathalias makedb
  130.  
  131. $(OBJ):    $(HDRS)
  132.  
  133. parse.c: parse.y $(HDRS)
  134.     $(YACC) $(YFLAGS) parse.y
  135.     mv y.tab.c parse.c
  136.  
  137. makedb: makedb.o
  138.     $(CC) $(LDFLAGS) makedb.o $(DBM) -o makedb
  139.  
  140. makedb.o: config.h
  141.  
  142. clean:
  143.     rm -f *.o y.tab.? parse.c
  144.  
  145. clobber: clean
  146.     rm -f pathalias makedb
  147.  
  148. tags: $(SRC) $(HDRS) makedb.c
  149.     ctags -w $(HDRS) $(SRC)
  150.  
  151. bundle:
  152.     @bundle README CHANGES pathalias.1 Makefile ${HDRS} ${SRC} makedb.c
  153.  
  154. lint:    $(LSRC)
  155.     lint $(CFLAGS) $(LSRC)
  156.     lint makedb.c
  157.  
  158. install:
  159.     @echo "install pathalias according to local conventions"
  160. SHAR_EOF
  161. if test 1078 -ne "`wc -c < 'Makefile'`"
  162. then
  163.     echo shar: error transmitting "'Makefile'" '(should have been 1078 characters)'
  164. fi
  165. fi
  166. echo shar: extracting "'config.h'" '(2010 characters)'
  167. if test -f 'config.h'
  168. then
  169.     echo shar: will not over-write existing file "'config.h'"
  170. else
  171. cat << \SHAR_EOF > 'config.h'
  172. /* pathalias -- by steve bellovin, as told to peter honeyman */
  173.  
  174. #define STRCHR        /* have strchr, not index -- probably system v */
  175. #define UNAME        /* have uname() -- probably system v or 8th ed. */
  176. #define MEMSET        /* have memset() -- probably system v or 8th ed. */
  177.  
  178. /* #define GETHOSTNAME    /* have gethostname() -- probably 4.2bsd */
  179. /* #define BZERO    /* have bzero() -- probably 4.2bsd */
  180.  
  181. /* default place for dbm output of makedb (or use -o file at run-time) */
  182. #define    ALIASDB    "/usr/local/lib/palias"
  183.  
  184.  
  185.  
  186. /**************************************************************************
  187.  *                                      *
  188.  * +--------------------------------------------------------------------+ *
  189.  * |                                    | *
  190.  * |            END OF CONFIGURATION SECTION            | *
  191.  * |                                    | *
  192.  * |                EDIT NO MORE                | *
  193.  * |                                    | *
  194.  * +--------------------------------------------------------------------+ *
  195.  *                                      *
  196.  **************************************************************************/
  197.  
  198. #ifdef MAIN
  199. #ifndef lint
  200. static char    *c_sccsid = "@(#)config.h    8.1 (down!honey) 86/01/19";
  201. #endif /*lint*/
  202. #endif /*MAIN*/
  203.  
  204. /*
  205.  * malloc/free fine tuned for pathalias.
  206.  *
  207.  * MYMALLOC should work everwhere, so it's not a configuration
  208.  * option (anymore).  nonetheless, if you're getting strange
  209.  * core dumps (or panics!), comment out the following manifest,
  210.  * and use the inferior C library malloc/free.
  211.  *
  212.  * report problems to princeton!honey.
  213.  */
  214. #define MYMALLOC    /**/
  215.  
  216. #ifdef MYMALLOC
  217. #define malloc mymalloc
  218. #define calloc(n, s) malloc ((n)*(s))
  219. #define free(s)
  220. #define cfree(s)
  221. extern char *memget();
  222. #endif
  223.  
  224. #ifdef STRCHR
  225. #define index strchr
  226. #define rindex strrchr
  227. #else
  228. #define strchr index
  229. #define strrchr rindex
  230. #endif
  231.  
  232. #ifdef BZERO
  233. #define strclear(s, n)    ((void) bzero((s), (n)))
  234. #else /*!BZERO*/
  235.  
  236. #ifdef MEMSET
  237. extern char    *memset();
  238. #define strclear(s, n)    ((void) memset((s), 0, (n)))
  239. #else /*!MEMSET*/
  240. extern void    strclear();
  241. #endif /*MEMSET*/
  242.  
  243. #endif /*BZERO*/
  244.  
  245. extern char    *malloc();
  246. extern char    *strcpy(), *index(), *rindex();
  247. SHAR_EOF
  248. if test 2010 -ne "`wc -c < 'config.h'`"
  249. then
  250.     echo shar: error transmitting "'config.h'" '(should have been 2010 characters)'
  251. fi
  252. fi
  253. echo shar: extracting "'def.h'" '(4683 characters)'
  254. if test -f 'def.h'
  255. then
  256.     echo shar: will not over-write existing file "'def.h'"
  257. else
  258. cat << \SHAR_EOF > 'def.h'
  259. /* pathalias -- by steve bellovin, as told to peter honeyman */
  260. #ifndef lint
  261. #ifdef MAIN
  262. static char    *h_sccsid = "@(#)def.h    8.1 (down!honey) 86/01/19";
  263. #endif /*MAIN*/
  264. #endif /*lint*/
  265.  
  266. #include <stdio.h>
  267. #include <ctype.h>
  268. #include "config.h"
  269.  
  270. typedef    long Cost;
  271. typedef struct node node;
  272. typedef struct link link;
  273.  
  274. #ifdef lint
  275. #define vprintf fprintf
  276. #else /*!lint -- this gives null effect warning*/
  277. /* because it's there ... */
  278. #define vprintf        !Vflag ? 0 : fprintf
  279. #endif /*lint*/
  280.  
  281. #define NTRACE    16    /* can trace up to NTRACE hosts/links */
  282.  
  283. /* scanner states (yylex, parse) */
  284. #define OTHER 0
  285. #define COSTING 1
  286. #define NEWLINE 2
  287.  
  288. #define    isnetc(c)    ((c)=='!' || (c)==':' || (c)=='@' || (c)=='%')
  289.  
  290. #define dirbits(c)    (c)
  291.  
  292. /* flags for n_flag */
  293. #define ISPRIVATE  0x0001 /* this node invisible outside its definition file */
  294. #define COLLISION  0x0002 /* collides with a private host name */
  295. #define ATSIGN       0x0004 /* seen an at sign?  used for magic @/% rules */
  296. #define MAPPED       0x0008 /* done mapping this node */
  297. #define    NDEAD       0x0010 /* node is dead */
  298. #define HASLEFT       0x0020 /* route has a left side net character */
  299. #define HASRIGHT   0x0040 /* route has a right side net character */
  300. #define    NNET       0x0080 /* node is a network name */
  301. #define INDFS       0x0100 /* used when removing net cycles */
  302. #define DUMP       0x0200 /* we have dumped this net's edges */
  303. #define GATEWAYIN  0x0400 /* heaped via gatewayed net */
  304.  
  305. #define ISADOMAIN(n) ((n)->n_name[0] == '.')
  306. #define ISANET(n) (((n)->n_flag & NNET) || ISADOMAIN(n))
  307. #define DEADHOST(n) (((n)->n_flag & (NNET | NDEAD)) == NDEAD)
  308. #define GATEWAYED(n) (((n)->n_flag & (NNET | NDEAD)) == (NNET | NDEAD) || ISADOMAIN(n))
  309.  
  310.  
  311. /*
  312.  * save some space in nodes -- there are > 10,000 allocated!
  313.  *
  314.  *    node    *n_net        others in this network (parsing)
  315.  *     node    *n_root        root of net cycle (mapping)
  316.  *
  317.  *    node    *n_private    other privates in this file (parsing)
  318.  *    char    *n_parent    parent in shortest path tree (mapping)
  319.  *        
  320.  */
  321.  
  322. #define n_root n_net_root
  323. #define n_net n_net_root
  324.  
  325. #define n_private n_private_parent
  326. #define n_parent  n_private_parent
  327.  
  328. /* WARNING: if > 2^16 nodes, type of n_tloc must change */
  329. struct node {
  330.     char    *n_name;    /* host name */
  331.     link    *n_link;    /* head of adjacency list */
  332.     node     *n_net_root;
  333.     node    *n_private_parent;
  334.     Cost    n_cost;        /* cost to this host */
  335.     unsigned short    n_tloc;    /* back ptr to heap/hash table */
  336.     short    n_flag;        /* see manifests above */
  337. };
  338.  
  339. #define    DEFNET    '!'            /* default network operator */
  340. #define    DEFDIR    LLEFT            /* host on left is default */
  341. #define    DEFCOST    ((Cost) 4000)        /* default cost of a link */
  342. #define    INF    ((Cost) 30000000)    /* infinitely expensive link */
  343.  
  344. /* data structure for adjacency list representation */
  345.  
  346. /* flags for l_dir */
  347.  
  348. /*
  349.  * there's an ugly dependency between the following manifests and the
  350.  * variable Netchars = "!:^@%", defined in extern.c.  this saves 2
  351.  * bytes per link (of which there are well over 20k).  this does not
  352.  * mean i'm satsified with bad design.
  353.  */
  354. #define NETDIR(l)    ((l)->l_flag & LDIR)
  355. #define NETCHAR(l)    (Netchars[(l)->l_flag & LNETCHARS])
  356.  
  357. #define LNETCHARS    0x3
  358. #define LBANG        0x0
  359. #define LCOLON        0x1
  360. #define LAT        0x2
  361. #define LPERCENT    0x3
  362.  
  363. #define LDIR    0x8    /* 0 for left, 1 for right */
  364. #define LRIGHT    0x0    /* user@host style */
  365. #define LLEFT    0x8    /* host!user style */
  366.  
  367. #define LDEAD     0x10    /* this link is dead */
  368. #define LTREE     0x20    /* member of shortest path tree */
  369. #define LALIAS     0x40    /* alias */
  370. #define LGATEWAY 0x80    /* this link is a gateway */
  371.  
  372. /*
  373.  * borrow a field for link/node tracing
  374.  *
  375.  *    link    *l_next;    rest of adjacency list (not tracing)
  376.  *    link    *l_from;    source node (tracing) -- requires a cast
  377.  *        
  378.  */
  379.  
  380. #define l_next    l_next_from
  381. #define l_from    l_next_from
  382.  
  383. struct link {
  384.     link    *l_next_from;
  385.     node    *l_to;        /* adjacent node */
  386.     Cost    l_cost;        /* edge cost */
  387.     char    l_flag;        /* right/left syntax */
  388. };
  389.  
  390. /*
  391.  * static functions don't show up in prof(1), so ...
  392.  * someday i'll be done profiling.
  393.  * yeah, sure, like when hell freezes over.
  394.  */
  395. #define STATIC /*static*/
  396.  
  397. /* external functions */
  398. extern node    *addnode(), *newnode(), **newtable(), *addprivate();
  399. extern link    *addlink(), *addgateway(), *newlink();
  400. extern char    *strsave(), *local();
  401. extern void    pack();
  402.  
  403. /* external variables */
  404. extern char    *optarg;
  405. extern int    optind;
  406. extern node    *Home;
  407. extern char    *Cfile;
  408. extern char    **Ifiles;
  409. extern char    *ProgName;
  410. extern int    Lineno;
  411. extern node    **Table;
  412. extern long    Tabsize;
  413. extern char    *Netchars;
  414. extern int    Vflag;
  415. extern int    Cflag;
  416. extern int    Iflag;
  417. extern int    Tflag;
  418. extern int    Ncount;
  419. extern int    Lcount;
  420. extern char    *Graphout;
  421. extern char    *Linkout;
  422. extern node    *Private;
  423. extern long    Hashpart;
  424. extern int    Scanstate;
  425. SHAR_EOF
  426. if test 4683 -ne "`wc -c < 'def.h'`"
  427. then
  428.     echo shar: error transmitting "'def.h'" '(should have been 4683 characters)'
  429. fi
  430. fi
  431. echo shar: extracting "'make.v8'" '(3555 characters)'
  432. if test -f 'make.v8'
  433. then
  434.     echo shar: will not over-write existing file "'make.v8'"
  435. else
  436. cat << \SHAR_EOF > 'make.v8'
  437. #!/bin/make -f
  438. # pathalias -- by steve bellovin, as told to peter honeyman
  439.  
  440. # if you can't or don't intend to use dbm files, don't bother with makedb
  441. DBM = -ldbm
  442. # or if you roll your own ...
  443. # DBM = dbm.o
  444.  
  445. CC = cc -g -p
  446. CFLAGS = 
  447. LDFLAGS =
  448. YFLAGS = -d
  449.  
  450. OBJ = addlink.o addnode.o extern.o local.o main.o mapit.o mapaux.o mem.o parse.o printit.o
  451. HDRS = def.h config.h
  452. CSRC = addlink.c addnode.c extern.c local.c main.c mapit.c mapaux.c mem.c printit.c
  453. SRC = $(CSRC) parse.y
  454. LSRC = $(CSRC) parse.c
  455.  
  456. pathalias: & $(OBJ)
  457.     $(CC) $(LDFLAGS) $(OBJ) -o pathalias
  458.  
  459. all: pathalias makedb
  460.  
  461. $(OBJ):    def.h
  462.  
  463. # if touch had a proper exit status, this would work...
  464. def.h: config.h
  465.     -touch -c def.h
  466.     get -s sccs/s.def.h
  467.  
  468. parse.c: parse.y def.h
  469.     $(YACC) $(YFLAGS) parse.y
  470.     mv y.tab.c parse.c
  471.  
  472. makedb: makedb.o
  473.     $(CC) makedb.o $(DBM) -o makedb
  474.  
  475. makedb.o: config.h
  476.  
  477. clean:
  478.     rm -f *.o y.tab.? parse.c
  479.  
  480. tags: $(SRC) $(HDRS) makedb.c
  481.     ctags -w $^
  482.  
  483. bundle: README CHANGES pathalias.1 Makefile ${HDRS} ${SRC} makedb.c make.v8
  484.     @bundle $^
  485.  
  486. bundle1: README CHANGES pathalias.1 Makefile def.h config.h addlink.c
  487.     @bundle $^
  488.  
  489. bundle2: addnode.c extern.c local.c main.c mapit.c
  490.     @bundle $^
  491.  
  492. bundle3: mapaux.c mem.c printit.c parse.y makedb.c make.v8
  493.     @bundle $^
  494.  
  495. make.v8: makefile
  496.     @cp makefile make.v8
  497.  
  498. lint:    $(LSRC)
  499.     lint $(CFLAGS) $(LSRC)
  500.     lint makedb.c
  501.  
  502. # v8 make rules for sccs
  503. %: & sccs/s.%
  504.     get -s sccs/s.$%
  505.  
  506. # the remainder is site specific and can be deleted.  it doesn't have
  507. # to be this complicated, but a makefile tends to swell after three or
  508. # four years.
  509.  
  510. # hosts running delivermail
  511. DELIVERMAIL = tilt
  512.  
  513. # hosts running sendmail
  514. SENDMAIL = quirky flakey yoyo panic
  515.  
  516. # all neighbors
  517. NEIGHBORS = princeton ${DELIVERMAIL} ${SENDMAIL}
  518.  
  519. # including me
  520. SITES = down ${NEIGHBORS}
  521.  
  522. PATHFILES = paths/[^.]* paths.bell/[^.]* paths.internet/[^.]* path.map/[^.]*
  523.  
  524. # from observation and rumor.  avoid like the plague
  525. DEADHOSTS = -d tucc -d netword -d harvard -d whuxlb -d conejo
  526.  
  527. DEADLINKS = -d siemens!uiucdcs -d allegra!rcalabs -d amdcad!chi -d allegra!shasta -d allegra!olympus -d shasta!imagen
  528.  
  529. DEADNETS = -d internet
  530.  
  531. DEAD = ${DEADHOSTS} ${DEADLINKS} ${DEADNETS}
  532.  
  533. # map output (input, really) to lower case.  dead links.
  534. ARGS = -i
  535.  
  536. paths:    ${SITES}
  537.  
  538. down:    paths/princeton
  539.     time -v pathalias -v ${ARGS} $(DEAD) $(PATHFILES) 2>ERRORS > down.new
  540.     sort -o down down.new
  541.  
  542. # DELIVERMAIL and SENDMAIL have exactly the same links as down, so turn
  543. #    down    %s
  544. #    up    up!%s
  545. # into
  546. #    up    %s
  547. #    down    down!%s
  548.  
  549. ${DELIVERMAIL}:    down
  550.     sed -e 's/^down    %s$$/$@    %s/' \
  551.         -e 's/^$@    $@!%s$$/down    down!%s/'\
  552.         -e 's/^/0    /' down | sort > $@
  553.     
  554. # reorder the output and generate phoney costs for sendmail neighbors
  555. ${SENDMAIL}: down
  556.     sed -e 's/^down    %s$$/$@    %s/' \
  557.          -e 's/$@    $@!%s$$/down    down!%s/'\
  558.          -e 's/    /    0    /' down |sort > $@
  559.  
  560. # install everywhere
  561. shipit: ${NEIGHBORS}
  562.     for i in ${SENDMAIL} princeton; do cp $$i /n/$$i/usr/local/lib/pathaliases; done
  563.     for i in ${DELIVERMAIL}; do cp $$i /n/$$i/usr/local/lib/pathaliases; $$i newaliases done
  564.     touch shipit
  565.  
  566. # reorder the output for princeton/sendmail/uubang and generate phoney costs.
  567. princeton: down
  568.     pathalias ${ARGS} $(DEAD) -l princeton $(PATHFILES) 2>ERRORS | sort | sed 's/\(.*\)    \(.*\)/\1    0    \2/' > princeton
  569.  
  570. # desperation debugging -- examine the costs.
  571. costs:
  572.     pathalias -vci ${DEAD} -l down $(PATHFILES) > down.costs 2>ERRORS
  573.  
  574. # make one BIG file.  a BIG bad idea.
  575. cat:
  576.     cat $(PATHFILES) > CAT
  577.  
  578. # make a pathparse database.  -g flag is undocumented.
  579. edges: down
  580.     pathalias -i -g edges $(PATHFILES) >/dev/null
  581.     makedb edges down
  582. SHAR_EOF
  583. if test 3555 -ne "`wc -c < 'make.v8'`"
  584. then
  585.     echo shar: error transmitting "'make.v8'" '(should have been 3555 characters)'
  586. fi
  587. fi
  588. echo shar: extracting "'pathalias.1'" '(9277 characters)'
  589. if test -f 'pathalias.1'
  590. then
  591.     echo shar: will not over-write existing file "'pathalias.1'"
  592. else
  593. cat << \SHAR_EOF > 'pathalias.1'
  594. .\" Thanks to Alan Silverstein for help with the manual entry.
  595. .TH PATHALIAS 1 
  596. .SH NAME
  597. pathalias, makedb \- electronic address router
  598. .SH SYNOPSIS
  599. .B pathalias
  600. [
  601. .B \-ivc
  602. ] [
  603. .BI \-t \0link
  604. ] [
  605. .BI \-l \0host
  606. ] [
  607. .BI \-d \0link
  608. ] [
  609. .ig
  610. .\" the -g option is for pathparse.  it's not really used by pathalias.
  611. .BI \-g \0file
  612. ] [
  613. ..
  614. .I files
  615. ]
  616. .PP
  617. .B makedb
  618. [
  619. .B \-a
  620. ] [
  621. .BI \-o \0dbmfile
  622. ] [
  623. .I files ...
  624. ]
  625. .ad b
  626. .SH DESCRIPTION
  627. .I pathalias
  628. computes the shortest paths and corresponding routes from one host
  629. (computer system) to all other known, reachable hosts.
  630. .I pathalias
  631. reads host-to-host connectivity
  632. information on standard input or in the named
  633. .IR files ,
  634. and writes a list of
  635. host-route pairs on the standard output.
  636. .PP
  637. .I makedb
  638. takes
  639. .I pathalias
  640. output and creates or appends to a
  641. .IR dbm (3)
  642. database.
  643. .PP
  644. Here are the
  645. .I pathalias
  646. options:
  647. .TP 6
  648. .B \-i
  649. Ignore case:  map all host names to lower case.
  650. By default, case is significant.
  651. .TP
  652. .B \-c
  653. Print costs: print the path cost (see below) before each host-route pair.
  654. .TP
  655. .B \-v
  656. Verbose: report some statistics on the standard error output.
  657. .ig
  658. .\" the -g option is for pathparse and is not for public consumption (yet!).
  659. .TP
  660. .BI \-g \0file
  661. Dump the edges of the graph into the named file.
  662. ..
  663. .TP
  664. .BI \-l \0host
  665. Set local host name to
  666. .IR host .
  667. By default,
  668. .I pathalias
  669. discovers the local host name in a system-dependent way.
  670. .TP
  671. .BI \-d \0arg
  672. Declare a dead link, host, or network (see below).
  673. If
  674. .I arg
  675. is of the form ``host1!host2,'' the link from host1 to host2
  676. is treated as an extremely high cost (\fIi.e.\fP, \s-1DEAD\s0) link.
  677. If
  678. .I arg
  679. is a single host name,
  680. that host is treated as dead
  681. and is be used as an intermediate host of last resort on any path.
  682. If
  683. .I arg
  684. is a network name, the network requires a gateway.
  685. .TP
  686. .BR  \-t \0arg
  687. Trace input for link, host or network on the standard error output.
  688. The form of
  689. .I arg
  690. is as above.
  691. .PP
  692. Here are the
  693. .I makedb
  694. options:
  695. .TP 6
  696. .B \-a
  697. Append to an existing database;
  698. by default,
  699. .I makedb
  700. truncates the database.
  701. .TP
  702. .BI \-o \0dbmfile
  703. Identify the output file base name.
  704. .SS \fIpathalias\fP Input Format
  705. A line beginning with white space continues the preceding line.
  706. Anything following `#' on an input line is ignored.
  707. .PP
  708. A list of host-to-host connections consists of a ``from'' host in column 1,
  709. followed by white space,
  710. followed by a comma-separated list of ``to' hosts, called
  711. .IR links .
  712. A link may be preceded or followed by a network character to use
  713. in the route.
  714. Valid network characters are `!' (default), `@', `:', and `%'.
  715. A link (and network character, if present) may be
  716. followed by a ``cost'' enclosed in parentheses.
  717. Costs may be arbitrary
  718. arithmetic expressions involving numbers, parentheses, `+', `\-', `*',
  719. and `/'.
  720. The following symbolic costs are
  721. recognized:
  722. .RS
  723. .nf
  724. .ta 10mR 15m
  725.  
  726. \s-1LOCAL\s0    25    (local-area network connection)
  727. \s-1DEDICATED\s0    95    (high speed dedicated link)
  728. \s-1DIRECT\s0    200    (toll-free call)
  729. \s-1DEMAND\s0    300    (long-distance call)
  730. \s-1HOURLY\s0    500    (hourly poll)
  731. \s-1EVENING\s0    1800    (time restricted call)
  732. \s-1DAILY\s0    5000    (daily poll, also called \s-1POLLED\s0)
  733. \s-1WEEKLY\s0    30000    (irregular poll)
  734. .fi
  735. .RE
  736. .PP
  737. In addition,
  738. .SM DEAD
  739. is a very large number (effectively infinite),
  740. and
  741. .SM HIGH
  742. and
  743. .SM LOW
  744. are \-5 and +5 respectively,
  745. for baud-rate or quality bonuses/penalties.
  746. These symbolic costs represent an imperfect measure of bandwidth,
  747. monetary cost, and frequency of connections.
  748. For most mail traffic, it is important to minimize the number
  749. of intermediaries in a route,
  750. thus,
  751. .IR e.g. ,
  752. .SM HOURLY
  753. is far greater than
  754. .SM DAILY
  755. / 24.
  756. If no cost is given,
  757. a default of 4000 is used.
  758. .PP
  759. For the most part, arithmetic expressions that mix symbolic constants
  760. other than
  761. .SM HIGH
  762. and
  763. .SM LOW
  764. make no sense.
  765. .IR E.g. ,
  766. if a host calls a local neighbor whenever there is work,
  767. and additionally polls every evening,
  768. the cost is
  769. .SM DIRECT,
  770. .B not
  771. .SM DIRECT+EVENING.
  772. .PP
  773. Some examples:
  774. .RS
  775. .nf
  776. .ta 10m 15m
  777.  
  778. down    princeton!(\s-1DEDICATED\s0), tilt,
  779.     %thrash(\s-1LOCAL\s0)
  780. princeton    topaz!(\s-1DEMAND\s0+\s-1LOW\s0)
  781. topaz    @rutgers(\s-1LOCAL\s0)
  782. .fi
  783. .RE
  784. .PP
  785. .fi
  786. .RE
  787. If a link is encountered more than once,
  788. the least-cost occurrence dictates the cost and network character.
  789. Links are treated as bidirectional, to the extent that a
  790. .SM DEAD
  791. reverse link is assumed unless better information is available.
  792. .PP
  793. The set of names by which a host is known by its neighbors is
  794. called its
  795. .IR aliases .
  796. Aliases are declared as follows:
  797. .RS
  798.  
  799. name = alias, alias ...
  800. .RE
  801. .PP
  802. The name used in the route to or through aliased hosts
  803. is the name by which the host is known
  804. to its predecessor in the route.
  805. .PP
  806. Fully connected networks, such as the
  807. .SM ARPANET
  808. or a local-area network,
  809. are declared as follows:
  810. .RS
  811.  
  812. net = {host, host, ...}
  813. .RE
  814. .PP
  815. The host-list may be preceded or followed by a routing
  816. character, and may be followed by a cost:
  817. .RS
  818. .nf
  819.  
  820. princeton-ethernet = {down, up, princeton}!(\s-1LOCAL\s0)
  821. \s-1ARPA\s0 = @{sri-unix, mit-ai, su-score}(\s-1DEDICATED\s0)
  822. .fi
  823. .RE
  824. .PP
  825. See also the sections on
  826. .I gateways
  827. and
  828. .I domains
  829. below.
  830. .PP
  831. Connection data may be given while hiding host names
  832. by declaring
  833. .RS
  834.  
  835. private {host, host, ...}
  836. .RE
  837. .PP
  838. .I pathalias
  839. will not generate routes for private hosts or for any
  840. host with the same name as a private host, but may produce routes
  841. through them.
  842. The scope of a private declaration extends from the declaration to the end of
  843. the input file in which it appears.
  844. It is best to put private declarations at the beginning of the appropriate
  845. input file.
  846. .SS Output Format
  847. A list of host-route pairs is written to the standard output,
  848. where route is a string appropriate for use with
  849. .IR printf (3),
  850. .IR e.g. ,
  851. .RS
  852. .nf
  853. .ta 10m 20m
  854.  
  855. rutgers    princeton!topaz!%s@rutgers
  856. .fi
  857. .RE
  858. .PP
  859. The ``%s'' in the route string should be replaced by the
  860. user name at the destination host.
  861. (This task is normally performed by a mailer.)
  862. .PP
  863. Except for
  864. .I domains
  865. (see below),
  866. the name of a network is never used in
  867. expansions.
  868. Thus, in the earlier example, the path from down to
  869. up would be ``up!%s,'' not ``princeton-ethernet!up!%s.''
  870. .SS Gateways
  871. A network is represented by
  872. a pseudo-host and a set of network members.
  873. Links from the members to the network have the weight given in
  874. the input, while the cost from the network to the members is zero.
  875. If a network is declared dead on the command line (with the
  876. .B \-d
  877. option),
  878. the member-to-network links are marked dead,
  879. which discourages paths to members by way of the network.
  880. .PP
  881. If the input also shows a link from a host to the network,
  882. then that host will be preferred as a gateway.
  883. Gateways need not be network members.
  884. .PP
  885. .IR E.g. ,
  886. suppose
  887. .SM CSNET
  888. is declared dead on the command line
  889. and the input contains
  890. .RS
  891. .nf
  892. .ta 10m 20m
  893.  
  894. \s-1CSNET\s0 = {...}
  895. csnet-relay    csnet
  896. .fi
  897. .RE
  898. .PP
  899. Then routes to
  900. .SM CSNET
  901. hosts will use csnet-relay as a gateway.
  902. .PP
  903. .I pathalias
  904. discourages forwarding beyond dead networks.
  905. .SS Domains
  906. A host or network whose name begins with `.' is called
  907. a domain.
  908. Domains are presumed to require gateways,
  909. .IR i.e. ,
  910. they are \s-1DEAD\s0.
  911. The route given by a path through a domain is similar to
  912. that for a network, but here
  913. the domain name is tacked onto the end of the next host.
  914. Subdomains are permitted.
  915. .IR E.g. ,
  916. .RS
  917. .nf
  918. .ta 1i
  919. .ta 10m 20m
  920.  
  921. harvard    .\s-1EDU\s0
  922. \&.\s-1EDU\s0 = {.\s-1BERKELEY\s0}
  923. \&.\s-1BERKELEY\s0    ernie
  924.  
  925. .fi
  926. .RE
  927. yields
  928. .RS
  929. .nf
  930. .ta 10m 20m
  931.  
  932. ernie    ...!harvard!ernie.\s-1BERKELEY\s0.\s-1EDU\s0!%s
  933. .fi
  934. .RE
  935. .PP
  936. If a domain member is declared private, its fully qualified domain name
  937. is shown instead.
  938. .IR E.g. ,
  939. if ernie is declared a
  940. private member of .\s-1BERKELEY\s0, then the output is
  941. .RS
  942. .nf
  943. .ta 10m 25m
  944.  
  945. ernie.\s-1BERKELEY\s0.\s-1EDU\s0    ...!harvard!ernie.\s-1BERKELEY\s0.\s-1EDU\s0!%s
  946. .fi
  947. .RE
  948. .PP
  949. Output is also given for the nearest gateway
  950. to a domain or subdomain.
  951. .IR E.g. ,
  952. in the example above
  953. .RS
  954. .nf
  955. .ta 10m 25m
  956.  
  957. \&.\s-1EDU\s0    ...!harvard!%s
  958. \&.\s-1BERKELEY\s0.\s-1EDU\s0    ...!harvard!%s
  959. .fi
  960. .RE
  961. .SS Databases
  962. .I Makedb
  963. builds a
  964. .IR dbm (3)
  965. database from the standard input or from the named
  966. .IR files .
  967. (\fIMakedb\fP replaces the obsolete 
  968. .B \-b
  969. option of
  970. .IR pathalias ,
  971. which is no longer recognized.)
  972. Input is expected to be sequence of
  973. .SM ASCII
  974. records,
  975. each consisting of a key field and a data field separated by a single tab.
  976. If the tab is missing, the data field is assumed to be empty.
  977. .SH FILES ET AL.
  978. .ta \w'/usr/local/lib/palias.{dir,pag}     'u
  979. /usr/local/lib/palias.{dir,pag}    default dbm output
  980. .br
  981. newsgroup mod.map    likely location of some input files
  982. .br
  983. .IR getopt (3),
  984. available from newsgroup mod.sources (if not in the C library).
  985. .SH BUGS
  986. The order of arguments is significant.
  987. In particular,
  988. .B \-i
  989. and
  990. .B \-t
  991. should appear early.
  992. .PP
  993. .I pathalias
  994. can generate hybrid (\fIi.e.\fP ambiguous) routes, which are
  995. abhorrent and most certainly should not be given as examples
  996. in the manual entry.
  997. .PP
  998. Multiple `@'s in routes are prohibited by many mailers, so
  999. .I pathalias
  1000. resorts to the ``magic %'' rule when appropriate.
  1001. (This convention is not documented anywhere, including here.)
  1002. .PP
  1003. Domains constitute a futile attempt to defeat anarchy and otherwise
  1004. retard progress.
  1005. .SH AUTHORS
  1006. Steve Bellovin (ulysses!smb)
  1007. .br
  1008. Peter Honeyman (princeton!honey)
  1009. SHAR_EOF
  1010. if test 9277 -ne "`wc -c < 'pathalias.1'`"
  1011. then
  1012.     echo shar: error transmitting "'pathalias.1'" '(should have been 9277 characters)'
  1013. fi
  1014. fi
  1015. exit 0
  1016. #    End of shell archive
  1017.